@echo off
echo this batch file zips recursively everything from the current directory
echo into one nicely timestamped filename and 
echo requirements: google download win gnu zip

:: set the nicetime var
call GetNiceTime_on_%computername%.cmd
:: variables setting
set _ProductBaseDir=E:\perl\sfw
set _ProductName=morphus
set _ProductDir=%_ProductBaseDir%\%_ProductName%
set _ProductVersion=0.1.0
set _ProductType=dev
set _ProductOwner=ysg
set _EnvironmentName=%_ProductName%.%_ProductVersion%.%_ProductType%.%_ProductOwner%
set _ZipFile=%_EnvironmentName%.zip
set _ZipFilePath=%_ProductDir%\%_ZipFile%
set _ProductVersionDir=%_BaseDir%\%_ProductName%\%_EnvironmentName%
set _ZipFileTimeStamped=%_ZipFile%.%NiceTime%.txt

::delete the previoues zip file 
del /q %_ZipFilePath%

:: DELETE ALL THE 
FOR /F %%i in ('dir %_ProductVersionDir%\*.log /s /b') do del /q %%i

cd %_ProductDir%

:: add the files into a package
zip -r %_ZipFile% %_EnvironmentName%\*

::debug echo nicetime is %niceTime%
::DEBUG PAUSE

::debug echo rename "%cd%\zipFile.zip" %niceTime%.zip.txt
::DEBUG PAUSE
:: make it a txt file for easier e-mail deleting 
rename "%cd%\%_ZipFile%" "%_ZipFileTimeStamped%"


::DEBUG PAUSE